using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ArgoszLite
{
    
    public sealed class Settings
    {
        static readonly Settings instance = new Settings();
        IniFile ini;        

        static Settings()
        {
            
        }

        Settings()
        {
        }

        public static Settings Instance
        {
            get
            {
                return instance;
            }
        }


   
        public void save_ini(){
            ini = new IniFile(".\\argosz.ini");

            ini.IniWriteValue("camera0", "cameraCenterX0", cameraCenterX0.ToString());
            ini.IniWriteValue("camera0", "cameraCenterY0", cameraCenterY0.ToString());
            ini.IniWriteValue("camera0", "radius0", radius0.ToString());

            ini.IniWriteValue("camera1", "cameraCenterX1", cameraCenterX1.ToString());
            ini.IniWriteValue("camera1", "cameraCenterY1", cameraCenterY1.ToString());
            ini.IniWriteValue("camera1", "radius1", radius1.ToString());

            ini.IniWriteValue("other", "camera_delay", camera_delay.ToString());
            ini.IniWriteValue("other", "cols", cols.ToString());
            ini.IniWriteValue("other", "rows", rows.ToString());

            ini = null;
        }
        public void load_ini(){
            ini = new IniFile(".\\argosz.ini");
            cameraCenterX0 = int.Parse(ini.IniReadValue("camera0", "cameraCenterX0"));
            cameraCenterY0 = int.Parse(ini.IniReadValue("camera0", "cameraCenterY0"));
            radius0 = int.Parse(ini.IniReadValue("camera0", "radius0"));

            cameraCenterX1 = int.Parse(ini.IniReadValue("camera1", "cameraCenterX1"));
            cameraCenterY1 = int.Parse(ini.IniReadValue("camera1", "cameraCenterY1"));
            radius1 = int.Parse(ini.IniReadValue("camera1", "radius1"));
            
            camera_delay = int.Parse(ini.IniReadValue("other", "camera_delay"));
            cols = int.Parse(ini.IniReadValue("other", "cols"));
            rows = int.Parse(ini.IniReadValue("other", "rows"));
            ini = null;
        }

        public void load_default_ini()
        {
            ini = new IniFile(".\\argosz_default.ini");
            cameraCenterX0 = int.Parse(ini.IniReadValue("camera0", "cameraCenterX0"));
            cameraCenterY0 = int.Parse(ini.IniReadValue("camera0", "cameraCenterY0"));
            radius0 = int.Parse(ini.IniReadValue("camera0", "radius0"));

            cameraCenterX1 = int.Parse(ini.IniReadValue("camera1", "cameraCenterX1"));
            cameraCenterY1 = int.Parse(ini.IniReadValue("camera1", "cameraCenterY1"));
            radius1 = int.Parse(ini.IniReadValue("camera1", "radius1"));

            ini = null;
        }


        private int cameraCenterX0 = 320;
        public int CameraCenterX0
        {
            get { return cameraCenterX0; }
            set { cameraCenterX0 = value; }
        }
        
        private int cameraCenterY0 = 240;
        public int CameraCenterY0
        {
            get { return cameraCenterY0; }
            set { cameraCenterY0 = value; }
        }
        
        private int radius0 = 200;
        public int Radius0
        {
            get { return radius0; }
            set { radius0 = value; }
        }
        //---
        private int cameraCenterX1 = 320;
        public int CameraCenterX1
        {
            get { return cameraCenterX1; }
            set { cameraCenterX1 = value; }
        }

        private int cameraCenterY1 = 240;
        public int CameraCenterY1
        {
            get { return cameraCenterY1; }
            set { cameraCenterY1 = value; }
        }

        private int radius1 = 200;
        public int Radius1
        {
            get { return radius1; }
            set { radius1 = value; }
        }
        //----
        private int camera_num = 0;

        public int Camera_num
        {
            get { return camera_num; }
            set { camera_num = value; }
        }

        private int camera_delay = 33;
        public int Camera_delay
        {
            get { return camera_delay; }
            set { camera_delay = value; }
        }
        
        private int cols = 20;
        public int Cols
        {
            get { return cols; }
            set { cols = value; }
        }

        private int rows = 10;
        public int Rows
        {
            get { return rows; }
            set { rows = value; }
        }

        //Settings setts = Settings.Instance;
    }
}
 